import BasePlatform from "./BasePlatform";
import PBPlatform from "./PBPlatform";
import QunHeiPlatform from "./QunHeiPlatform";

export default class PlatformManager {
    static _single: PlatformManager;

    basePlatform: BasePlatform;

    static get single(): PlatformManager {
        if (PlatformManager._single == null) {
            PlatformManager._single = new PlatformManager();
        }
        return PlatformManager._single;
    }

    initPlatform() {
        this.basePlatform = new PBPlatform();
        this.basePlatform.initSdk();
    }

    public pay(goodsId: number): Promise<void> {
        return this.basePlatform.pay(goodsId);
    }
}